package com.itheima.Dao.Impl;

import com.itheima.Dao.UserDao;
import com.itheima.domain.User;
import com.itheima.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class UserDaoImpl implements UserDao {

    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());

    @Override
    public List<User> Login(String username, String password) {
        /*String sql = "select * from user where username=? and password =?";

        List<User> list = template.query(sql, new BeanPropertyRowMapper<User>(User.class),username,password);

        if(list.size() == 0){
            return false;
        }else{
            return  true ;
        }*/
        String sql="select * from user";
        List<User> list = template.query(sql, new BeanPropertyRowMapper<User>(User.class));
        return list;

    }
}
